home *** CD-ROM | disk | FTP | other *** search
/ Network CD 2 / Network CD - Volume 2.iso / programs / graphics / texturestudio / rexx / rendertextures.tsrx < prev    next >
Encoding:
Text File  |  1995-04-10  |  3.6 KB  |  158 lines

  1. /* TextureStudio ARexx script **************************************/
  2.  
  3. /* Allow commands to return results */
  4.  
  5. options results
  6.  
  7. /* On error, goto ERROR:. Comment out this line if you wish to */
  8. /* perform your own error checking. */
  9.  
  10. signal on error
  11.  
  12. /* BEGIN PROGRAM *************************************************/
  13.  
  14. address "TEXTURESTUDIO"
  15.  
  16.  
  17. /* Filename extension used for renderscreen files */
  18.  
  19. FILENAME_EXTENSION = '.HAM'
  20.  
  21.  
  22. /* Bring TextureStudio's screen to the front */
  23.  
  24. SCREEN_FRONT
  25.  
  26. /* Get the user's texture path */
  27.  
  28. TEXTUREPATH_GET VAR texture_path
  29.  
  30. /* Get the user's renderscreen path */
  31.  
  32. RENDERSCREENPATH_GET VAR renderscreen_path
  33.  
  34. /* Display multiselect file requester to select texture modules */
  35.  
  36. REQUEST_MULTIFILE PATHPART '"'texture_path'"' PATTERN '"#?.itx"',
  37.     TITLE '"Select texture file(s)"' STEM 'selected.'
  38.  
  39. /* Request a destination path for renderscreen files */
  40.  
  41. REQUEST_DIR PATHPART '"'renderscreen_path'"' TITLE '"Select a destination dir"',
  42.     VAR 'dest_path'
  43.  
  44.  
  45. /* Stop input to windows */
  46.  
  47. GUI_BLOCK
  48.  
  49. /* Loop through each selected texture file and render to screen using current */
  50. /* user settings, then save out to selected path */
  51.  
  52. do c = 0 to (selected.files.count - 1)
  53.  
  54.     /* Open texture and flush out all others */
  55.  
  56.     OPEN selected.files.c FLUSH
  57.  
  58.     /* Render to screen */
  59.  
  60.     RENDER TOBACK
  61.  
  62.     /* Split source file into filepart and pathpart */
  63.  
  64.     FILE_SPLIT '"'selected.files.c'"' stem 'texture.'
  65.  
  66.     /* Chop off file extension */
  67.     /* e.g. Radar.itx -> Radar */
  68.  
  69.     parse var texture.filepart texture_name '.'
  70.  
  71.     /* Put filename extension onto texture name */
  72.     /* e.g. Radar -> Radar.HAM */
  73.  
  74.     dest_filepart = texture_name||FILENAME_EXTENSION
  75.  
  76.     /* Join destination file onto destination path */
  77.  
  78.     FILE_JOIN PATHPART '"'dest_path'"' FILEPART '"'dest_filepart'"',
  79.         VAR 'dest_file'
  80.  
  81.     /* Save out renderscreen */
  82.  
  83.     RENDERSCREEN_SAVE FILE '"'dest_file'"' FORCE
  84.  
  85. end
  86.  
  87. /* Unblock the windows now */
  88.  
  89. GUI_UNBLOCK
  90.  
  91.  
  92. /* END PROGRAM ***************************************************/
  93.  
  94. exit
  95.  
  96. /* On ERROR */
  97.  
  98. ERROR:
  99.  
  100. /* If we get here, either an error occurred with the command's */
  101. /* execution or there was an error with the command itself. */
  102. /* In the former case, rc2 contains the error message and in */
  103. /* the latter, rc2 contains an error number. SIGL contains */
  104. /* the line number of the command which caused the jump */
  105. /* to ERROR: */
  106.  
  107. if datatype(rc2,'NUMERIC') == 1 then do
  108.     /* See if we can describe the error with a string */
  109.  
  110.     select
  111.         when rc2 == 103 then
  112.             err_string = "ERROR 103, "||,
  113.                 "out of memory at line "||SIGL
  114.         when rc2 == 114 then
  115.             err_string = "ERROR 114, "||,
  116.                 "bad command template at line "||SIGL
  117.         when rc2 == 115 then
  118.             err_string = "ERROR 115, "||,
  119.                 "bad number for /N argument at line "||SIGL
  120.         when rc2 == 116 then
  121.             err_string = "ERROR 116, "||,
  122.                 "required argument missing at line "||SIGL
  123.         when rc2 == 117 then
  124.             err_string = "ERROR 117, "||,
  125.                 "value after keywork missing at line "||SIGL
  126.         when rc2 == 118 then
  127.             err_string = "ERROR 118, "||,
  128.                 "wrong number of arguments at line "||SIGL
  129.         when rc2 == 119 then
  130.             err_string = "ERROR 119, "||,
  131.                 "unmatched quotes at line "||SIGL
  132.         when rc2 == 120 then
  133.             err_string = "ERROR 120, "||,
  134.                 "line too long at line "||SIGL
  135.         when rc2 == 236 then
  136.             err_string = "ERROR 236, "||,
  137.                 "unknown command at line "||SIGL
  138.         otherwise
  139.             err_string = "ERROR "||rc2||" at line "||SIGL
  140.         end
  141.         end
  142. else if rc2 == 'RC2' then do
  143.     err_string = "ERROR in command at line "||SIGL
  144.     end
  145. else do
  146.         err_string = rc2||", line "||SIGL
  147.         end
  148.  
  149. say err_string
  150.  
  151.  
  152. /* Unblock windows, just incase they are still blocked by the program being */
  153. /* terminated mid-way */
  154.  
  155. GUI_UNBLOCK
  156.  
  157. exit
  158.